<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Axios</title>
</head>
<body>
<script src="js/axios-1.1.2.js"></script>
<script>
    // 1.get请求
    /*axios({
        method: "get",
        url: "http://localhost/P16_AJAX/axiosServlet?username=ZhangSan"
    }).then(function (resp) {
        alert(resp.data);
    })*/

    // 2.post请求
    /*axios({
        method: "post",
        url: "http://localhost/P16_AJAX/axiosServlet",
        data:"username=ZhangSan"
    }).then(function (resp) {
        alert(resp.data);
    })*/

    // 3.get方法请求
    /*axios.get("http://localhost/P16_AJAX/axiosServlet?username=LiSi").then(function (resp) {
        alert(resp.data);
    })*/

    // 4.post方法请求
    axios.post("http://localhost/P16_AJAX/axiosServlet","username=LiSi").then(function (resp) {
        alert(resp.data);
    })
</script>
</body>
</html>